﻿/**
 * ...
 * @author alijaya
 */

package homponex.utils;
import homponex.core.Component;
import homponex.utils.DynamicUtils;

class NameUtils 
{

	private static var table:Hash<Int> = new Hash<Int>();
	
	public static function getName(c:Component) : String
	{
		var className:String = DynamicUtils.getClassName(Type.getClass(c));
		if (!table.exists(className)) table.set(className, 0);
		var id:Int = table.get(className);
		table.set(className, id + 1);
		return className + "_" + Std.string(id);
	}
	
}